import React, { InputHTMLAttributes, forwardRef } from 'react';
import classNames from 'classnames';

export type InputSize = 'lg' | 'sm';
export type InputType = 'primary' | 'default' | 'danger';

export interface InputProps extends Omit<InputHTMLAttributes<HTMLInputElement>,'size' >{
  size?: InputSize;
  inputType?: InputType;
}

const Input = forwardRef<HTMLInputElement, InputProps>(({ size, inputType = 'default', className, ...props }, ref) => {
  const classes = classNames(
    'input',
    className,
    {
      [`input-${size}`]: size,
      [`input-${inputType}`]: inputType,
    }
  );
  return <input ref={ref} className={classes} {...props} />;
});

export default Input;
